package com.sleepsocial.security;

import java.util.Random;

public class PasswordGenerator {
    private static final String RANDOM_PASS_CHARSET = "ABCDEFGHIJKLMNOPQRSTUVXYWZabcdefghijklmnopqrstuvxywz0123456789!@#$%^&*()_+";

    private static final int    MAX_LENGTH          = 10;

    public static String generate() {
        Random rand = new Random(System.currentTimeMillis());
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < MAX_LENGTH; i++) {
            int pos = rand.nextInt(RANDOM_PASS_CHARSET.length());
            sb.append(RANDOM_PASS_CHARSET.charAt(pos));
        }
        return sb.toString();

    }
}
